import requests
import datetime
import sys
import os


url = 'http://' + sys.argv[1] + '/nacos/v1/cs/configs?export=true&tenant=&group=&appName=&dataId=&ids='
path = os.path.dirname(os.path.abspath(sys.argv[0])) + '/'
file_name = datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S') + '_nacos_backup.zip'
#print(now_time)
r = requests.get(url)
#print(r)
#print(r.content)


with open(path + file_name, 'wb') as f:
    f.write(r.content)


#2.	执行脚本 python backup_nacos.py 192.168.1.32:30961  脚本后面添加nacos服务的ip与端口